#include <iostream>
using namespace std;

int main()
{
    string s;
    getline(cin, s);
    int max_len = 1;
    for (int i = 0; i < s.length(); i++)
    {
        // 奇数型
        int k = 1;
        int this_len1 = 1;
        while ((i - k) >= 0 && (i + k) < s.length() && s[i - k] == s[i + k])
        {
            k++;
            this_len1 += 2;
        }
        max_len = max(max_len, this_len1);
        // 偶数型
        if ((i - 1) >= 0 && s[i - 1] == s[i])
        {
            int j = 1;
            int this_len2 = 2;
            while ((i - 1 - j) >= 0 && (i + j) < s.length() && s[i - 1 - j] == s[i + j])
            {
                j++;
                this_len2 += 2;
            }
            max_len = max(max_len, this_len2);
        }
    }
    cout << max_len;
    return 0;
}